package com.ruoyi.report.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.report.mapper.ReportScheduleMapper;
import com.ruoyi.report.domain.ReportSchedule;
import com.ruoyi.report.service.IReportScheduleService;
import com.ruoyi.common.core.text.Convert;

/**
 * 报定时任务Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-17
 */
@Service
public class ReportScheduleServiceImpl implements IReportScheduleService 
{
    @Autowired
    private ReportScheduleMapper reportScheduleMapper;

    /**
     * 查询报定时任务
     * 
     * @param scheduleId 报定时任务主键
     * @return 报定时任务
     */
    @Override
    public ReportSchedule selectReportScheduleByScheduleId(Long scheduleId)
    {
        return reportScheduleMapper.selectReportScheduleByScheduleId(scheduleId);
    }

    /**
     * 查询报定时任务列表
     * 
     * @param reportSchedule 报定时任务
     * @return 报定时任务
     */
    @Override
    public List<ReportSchedule> selectReportScheduleList(ReportSchedule reportSchedule)
    {
        return reportScheduleMapper.selectReportScheduleList(reportSchedule);
    }

    /**
     * 新增报定时任务
     * 
     * @param reportSchedule 报定时任务
     * @return 结果
     */
    @Override
    public int insertReportSchedule(ReportSchedule reportSchedule)
    {
        reportSchedule.setCreateTime(DateUtils.getNowDate());
        return reportScheduleMapper.insertReportSchedule(reportSchedule);
    }

    /**
     * 修改报定时任务
     * 
     * @param reportSchedule 报定时任务
     * @return 结果
     */
    @Override
    public int updateReportSchedule(ReportSchedule reportSchedule)
    {
        reportSchedule.setUpdateTime(DateUtils.getNowDate());
        return reportScheduleMapper.updateReportSchedule(reportSchedule);
    }

    /**
     * 批量删除报定时任务
     * 
     * @param scheduleIds 需要删除的报定时任务主键
     * @return 结果
     */
    @Override
    public int deleteReportScheduleByScheduleIds(String scheduleIds)
    {
        return reportScheduleMapper.deleteReportScheduleByScheduleIds(Convert.toStrArray(scheduleIds));
    }

    /**
     * 删除报定时任务信息
     * 
     * @param scheduleId 报定时任务主键
     * @return 结果
     */
    @Override
    public int deleteReportScheduleByScheduleId(Long scheduleId)
    {
        return reportScheduleMapper.deleteReportScheduleByScheduleId(scheduleId);
    }
}
